<#import "/freemarker/pagination.ftl" as p/>
<@p.paginationParm url="applyManager-query"/>
<script>
$(function() {
	showHidden();
});
function tog(i){
  $("#item_" + i).toggle();
}
function transfer_reimburseManager() {
	var code = $('#apply_code').val();
	var pc = $('#pc').val();
	if (code == null || pc == ''){
		return false;
	}
	console.log(code,pc);
	var parm =  {'code':code, 'pc': pc};
	var url = create_url('reimburseManager-transfer');
	$.ajax({type:'POST',url:url, data:parm,
		success:function (result) {
				sys_submiting_close();
			if (result == 'success') {
				sys_msg('操作成功!');
				$.fn.colorbox.close();
				sys_load_handle('reimburseManager');
			} else {
				sys_msg('操作失败!');
			}
		}
	});
}
</script>
<#assign i = 0 />
<#list pageBean.resultList as apply>
<div class="contentTable">
	<table class="table table-striped table-bordered table-hover" style="margin-bottom:0px;">
		<tr>
			<th style="width:50px;">标题</th>
			<td>${(apply.title)!''}</td>
			<input type="hidden" id="apply_code" value="${(apply.code)!''}"/>
		</tr>
		<tr>
			<th>申请人</th>
			<td>${(apply.on)!''}&nbsp;&nbsp;${(apply.cn)!''}&nbsp;&nbsp;${((apply.ct)?string('yyyy-MM-dd'))!''}</td>
		</tr>
		<tr>
			<th>审核状态</th>
			<td>
				<#list apply.auditStatusList as ads>
					<#if ads.status?? && ads.status == 1>
						${(ads.rn)!''}(${(ads.auName)!''}&nbsp;${(ads.at)?string('dd/MM/yy')}) &nbsp;<strong style="font-size:large;">&raquo;</strong>
					<#else>
						${(ads.rn)!''}(<font style="color:red;">待审核</font>)
						<#break/>
					</#if>
				</#list>
			</td>
		</tr>
		<tr>
			<#list apply.auditStatusList as list>
			<#if list.rc = rp && !list.au??>
				<th class="table-left">原因1</th>
				<td><textarea id="remark" name="remark" placeholder="驳回的话请你填写原因" value="${(list.remark)!''}" class="form_input radius4" ></textarea></td>
			</#if>
			</#list>
		</tr>
		<table style="width:100%; margin:0px;" class="table table-bordered" id="item_${i}" type="hidden">
			<thead>
				<tr>
					<th style="text-align:center; width:90px;">报销项目</th>
					<th style="text-align:center; width:40px;">金额</th>
					<th style="text-align:center;">费用明细</th>
				</tr>
			</thead>
			<tbody id="applyDetailListBody">
			<#if apply.itemList??>
			<#list apply.itemList as item>
				<tr class="rep">
					<td style="text-align:center;">${(item.project)!''}</td>
					<td>${(item.amount)!''}</td>
					<td>${(item.remark)!''}</td>
				</tr>
			</#list>
			</#if>
			</tbody>
		</table>
	</table>
	<div class="tableOpen">
		<div class="trigger">
			<a href="#">操作</a>
		</div>
		<div class="toggle_container">
		<#if (apply.auditStatusList?? && apply.auditStatusList?size gt 0)>
			<#list apply.auditStatusList as item>
			<input id="pc" value="${(item.pc)!''}" type="hidden"/>
				<#if item.au = cu>
					<tr>
						<td colspan="4"><span style="display: inline-block; padding: 2px 4px; border: 1px #ddd solid; text-align: center;color: red" >已审核</span></td>
					</tr>
				<#elseif item.rc = rp && !item.au??>
					<tr>
						<td colspan="5" style="text-align:center;">
							<a class="btn btn-info" href="javascript:;" onclick="javascript: updateDesignate1_reimburseManager($('#apply_code').val());" style="display: inline-block; padding: 2px 4px; border: 1px #ddd solid; text-align: center;color: green">通过</a>
							&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<a class="btn btn-info" href="javascript:;" onmousemove="javascript:check_reimburseManager();" onclick="javascript: updateDesignate2_reimburseManager($('#apply_code').val());" style="display: inline-block; padding: 2px 4px; border: 1px #ddd solid; text-align: center;color: red">驳回</a>
						<#if role??>
						&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
							<a class="btn btn-success" href="javascript:;" onclick="javascript: transfer_reimburseManager();" style="display: inline-block; padding: 2px 4px; border: 1px #ddd solid; text-align: center;color: red">移交彭总</a>
						</#if>
						</td>
					</tr>
					<#break/>
				</#if>
			</#list>
		</#if>
		</div>
	</div>
</div>
<#assign i = i + 1/>
</#list>